Skip to content

fix: collapse duplicate leaderboard entries for the same docs URL - #39

Open
devin-ai-integration[bot] wants to merge 1 commit into
mainfrom
devin/1785862922-dedupe-salesforce-entry
Open

fix: collapse duplicate leaderboard entries for the same docs URL#39
devin-ai-integration[bot] wants to merge 1 commit into
mainfrom
devin/1785862922-dedupe-salesforce-entry

Conversation

@devin-ai-integration

Copy link
Copy Markdown
Contributor

Summary

developer.salesforce.com/docs ended up with two rows: the curated salesforce entry and a URL-derived developer-salesforce-com-docs entry, each carrying a different grade for the same site. Any curated entry whose docsUrl has a path hits this — the slug resolution in POST /api/score only reuses a name-derived slug when the URL has no path, so a form submission of the same URL always mints a second slug:

const rawSlug = slugParam || (effectiveName && !urlPath && !isFernHost ? nameToSlug(effectiveName) : urlToSlug(url));
//                                              ^^^^^^^^ "/docs" → falls through to urlToSlug

Root-cause fix: look the URL up in the table first and reuse whatever slug it is already stored under, so a re-submit updates the existing entry instead of creating a sibling.

const storedSlugForUrl = slugParam ? null : await getScoreSlugByDocsUrl(url);
const rawSlug = slugParam || storedSlugForUrl || (effectiveName && !urlPath && !isFernHost ? ... );

getScoreSlugByDocsUrl matches on docs_url normalized for trailing slashes and case, and orders hidden ASC, scored_at DESC so a visible curated slug wins over a hidden auto-generated duplicate.

The already-existing duplicate row can't be fixed by that path, so it also gets a SLUG_ALIASES entry (developer-salesforce-com-docssalesforce), which makes the shared URL redirect to the curated entry and keeps the slug from ever being scored again.

Link to Devin session: https://app.devin.ai/sessions/b0437a2b21464d4c8bd6849e8507ddf1

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@devin-ai-integration

Copy link
Copy Markdown
Contributor Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment, CI, and merge conflict monitoring

@vercel

vercel Bot commented Aug 4, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
fern-agent-score Ready Ready Preview Aug 4, 2026 5:03pm

Request Review

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant